//package ServletDemo01;
//
//
//import entity.Admin;
//import util.GokJDBCUtil;
//
//import javax.servlet.ServletException;
//import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//
//
//
///**
// * Servlet implementation class LoginServlet
// */
//@WebServlet("/LoginServlet")
//public class LoginServlet extends HttpServlet {
//
//    private static final long serialVersionUID = 1L;
//
//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        String name = request.getParameter("name");
//        String pd = request.getParameter("pd");
//
//
//        Admin admin = GokJDBCUtil.queryForObject("select * from admin where name=? and pd=?", Admin.class, name, pd);
//
//        if (admin != null) {
//            HttpSession session = request.getSession();
//            ((HttpSession) session).setAttribute("name", name);
//            request.getRequestDispatcher("StudentList").forward(request, response);
//        } else {
//            request.setAttribute("msg", "用户密码错误!");
//            request.getRequestDispatcher("login.jsp").forward(request, response);
//        }
//
//    }
//
//    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//        doGet(request, response);
//    }
//}